package jmm;

/**
 * 单例模式
 *
 * @author <a href="mailto:huangzf3@asiainfo.com">huangzf</a>
 * @version 1.0.0
 * @since 2022/08/13 下午 02:29
 */
public class VolatileDCL {
    private volatile static Object obj;

    public static Object getInstance() {
        if (obj == null) {
            synchronized (VolatileDCL.class) {
                if (obj == null) {
                    obj = new Object();
                }
            }
        }
        return obj;
    }
}
